﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PSSMS.View.SysManage
{
    /// <summary>
    /// PurchW.xaml 的交互逻辑
    /// </summary>
    public partial class PurchW : UserControl
    {
        BLL.Purchase.PurchaseClient myClient = new BLL.Purchase.PurchaseClient();
        //实例化表格：接收筛选数据
        DataTable dtNew = new DataTable();
        public PurchW()
        {
            InitializeComponent();
        }

        private void PurClick(object sender, RoutedEventArgs e)
        {
            PuApp pua = new PuApp();
            pua.Show();
        }

        /// <summary>
        /// 老商品添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OldClick(object sender, RoutedEventArgs e)
        {
            OldCommAdd oca = new OldCommAdd();
            oca.Show();
        }
        /// <summary>
        /// 用户控件加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PurchW_Loaded(object sender, RoutedEventArgs e)
        {
            //查询采购进货信息
            SelectPur();
            //下拉框绑定
            DataTable dt = myClient.SelectOrderNo().Tables[0];
            dhao.ItemsSource = dt.DefaultView;
            dhao.DisplayMemberPath = "OrderNo";
            dhao.SelectedValuePath = "purchaseID";
        }
        /// <summary>
        /// 查询
        /// </summary>
        private void SelectPur()
        {
            //调用服务查询方法
            dtNew = myClient.CheckPurchase().Tables[0];
            DgrdModel.ItemsSource = dtNew.DefaultView;
        }
    }
}
